package com.xmh.spendingPlan.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Description;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.xmh.spendingPlan.service.SpendingPlanService;

@Controller
@RequestMapping("/SpendingPlan")
@CrossOrigin
public class SpendingPlanCountController {

	@Autowired
	private SpendingPlanService spendingPlanService;

	@RequestMapping("/spendingPlanCount")
	public ModelAndView spendingPlanCount() {
		ModelAndView mView = new ModelAndView();
		mView.setViewName("pages/bar1");
		return mView;
	}

	@Description("获取数据接口")
	@RequestMapping(value = "/selectList", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> selectList(@RequestBody Map<String, Object> data) {
		Map<String, Object> map = new HashMap<String, Object>();

		map.put("data", spendingPlanService.selectList());

		return map;
	}

}
